CLS T_INIT '::::::::::::::::::::::::::: ' BASICS EXAMPLES : 'FIGURE 1 CLS t_pen = 0 T_HOME T_PEN = 1 FOR N = 1 TO 720 T_FD (10) T_RT (N) NEXT N PAUSE 1 'POLYGONS CLS T_PEN = 0 T_HOME T_PEN = 1 FOR J = 3 TO 12 COLOR J FOR N = 1 TO J T_FD (50) T_RT (360/ J) NEXT N NEXT J PAUSE 1 'SPIRAL CLS T_PEN = 0 T_HOME T_PEN = 1 J = 0.05 FOR N = 1 TO 360 * 10 J = J + 0.001 T_FD (J) T_RT (1) NEXT N PAUSE 1 'POLIGON SPIRAL FOR J = 3 TO 12 CLS T_PEN = 0 T_HOME T_PEN = 1 FOR N = 10 TO 360* 2 STEP 3 T_FD (10+N) T_RT (360/J) NEXT N PAUSE 1 NEXT J PAUSE 1 'CIRCLES CLS T_PEN = 0 T_HOME T_PEN = 1 FOR J = 0 TO 5 STEP 0.1 FOR N = 0.25 TO 360 T_FD (J) T_RT (1) NEXT N NEXT J PAUSE 1 COLOR 3 'SHAPE CLS T_HOME T_PEN = 0 T_HOME T_PEN = 1 FOR N = 1 TO 20 T_FD (50) T_LT (90) T_FD (50) T_RT (90) T_FD (50) T_RT (90) T_FD (50) NEXT N COLOR 1 'Atom Orbit CLS T_HOME T_PEN = 0 T_HOME T_PEN = 1 for n = 1 to 11 for i = 0 to 359 t_fd (1) t_rt ((sin(rad(i/2)))) next i next n PAUSE 1 COLOR 0 'X CLS T_HOME T_PEN = 0 FOR J = 0 TO 360*10 STEP 10 T_HOME T_RT 150 T_FD 100 + (SQR(J/1000)) T_PEN = 1 FOR N = 0 TO 360 T_FD 2+(J/1000) T_RT 1 NEXT N T_PEN = 0 NEXT J COLOR 0 'Z CLS T_PEN = 0 T_HOME T_PEN = 1 FOR N = 0 TO 360000 T_GT ((sqr(N) * SIN(RAD(n))),( sqr(N) * COS(RAD(n)))) NEXT N end ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 'GRAPH TURTLE 'VARIABLES 'T_X : DISTANCE IN PIXELS 'T_Y : DISTANCE IN PIXELS 'T_DISTANCE : DISTANCE IN PIXELS 'T_PEN : 0 = PEN OFF 1 = PEN ON 'T_ANGLE : ANGLE IN DEGREES SUB T_INIT 'INIT GRAPH TURTLE T_W = XMAX T_H = YMAX T_CENTER_SCREEN_X = INT (T_W / 2) T_CENTER_SCREEN_Y = INT (T_H / 2) T_POSITION_X = T_CENTER_SCREEN_X T_POSITION_Y = T_CENTER_SCREEN_Y T_HEADING = 0 T_PEN = 1 END SUB T_GT (T_X,T_Y) 'GO TO NEW POSITION X,Y PIXELS T_NEW_POSITION_X = T_CENTER_SCREEN_X + T_X T_NEW_POSITION_Y = T_CENTER_SCREEN_Y + T_Y IF T_PEN = 1 THEN LINE T_POSITION_X, T_POSITION_Y, T_NEW_POSITION_X, T_NEW_POSITION_Y T_POSITION_X = T_NEW_POSITION_X T_POSITION_Y = T_NEW_POSITION_Y END SUB T_HOME 'GO HOME TURTLE IF T_PEN = 1 THEN LINE T_POSITION_X, T_POSITION_Y, T_CENTER_SCREEN_X,T_CENTER_SCREEN_Y T_POSITION_X = INT(T_W/2) T_POSITION_Y = INT(T_H/2) END SUB T_FD (T_DISTANCE) 'FORWARD X DISTANCE PIXELES T_NEW_POSITION_X = T_POSITION_X + (T_DISTANCE * SIN (T_HEADING)) T_NEW_POSITION_Y = T_POSITION_Y - (T_DISTANCE * COS (T_HEADING)) IF T_PEN = 1 THEN LINE T_POSITION_X, T_POSITION_Y, T_NEW_POSITION_X,T_NEW_POSITION_Y T_POSITION_X = T_NEW_POSITION_X T_POSITION_Y = T_NEW_POSITION_Y END SUB T_BK(T_DISTANCE) 'BACK X DISTANCE PIXELES T_NEW_POSITION_X = T_POSITION_X - ( T_DISTANCE * SIN (T_HEADING)) T_NEW_POSITION_Y = T_POSITION_Y + ( T_DISTANCE * COS (T_HEADING)) IF T_PEN = 1 THEN LINE T_POSITION_X, T_POSITION_Y, T_NEW_POSITION_X,T_NEW_POSITION_Y T_POSITION_X = T_NEW_POSITION_X T_POSITION_Y = T_NEW_POSITION_Y END sub T_RT (T_ANGLE) 'TURN RIGHT, ANGLE DEGREES T_HEADING = T_HEADING + RAD (T_ANGLE) END sub T_LT (T_ANGLE) 'TURN LEFT, ANGLE DEGREES T_HEADING = T_HEADING - RAD (T_ANGLE) END sub T_ORIENT (T_ANGLE) 'SET ORIENTATION TURTLE ANGLE DEGREES T_HEADING = RAD (T_ANGLE) END